package com.dao.impl;

import com.dao.ScDao;
import com.dao.ScForStudentDao;
import com.entity.Sc;
import com.mapper.ScMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("scDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class ScDaoImpl implements ScDao, ScForStudentDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private ScMapper scMapper;
    public List<Sc>  getAllScs() throws Exception{
        return scMapper.selectByExample(null);
    }


    @Override
    public Integer deleteScBySno(Integer scno) {
        return scMapper.deleteByPrimaryKey(scno);
    }

    @Override
    public Integer updateScBySno(Sc sc) {
        return scMapper.updateByPrimaryKey(sc);
    }

    @Override
    public Integer addScByScno(Sc sc) {
        return scMapper.insertSelective(sc);
    }

}